let express=require("express");
let router=express.Router()
let threeData=require("../mock/three.json")
let mysql = require("mysql");

//测试端口
router.get("/data",(req,res)=>{
    res.send({msg:"我是three的路由地址",chartThree:threeData})
})
// let conn = mysql.createConnection({
//     user:'mydb',
//     password:'hubu88661126',
//     host:'47.98.247.52',
//     database:'mydb',
//     port:'3306'
// });

let conn = mysql.createConnection({
    user:'root',
    password:'tianmingyan',
    host:'localhost',
    database:'tmy',
    port:'3306'
});

// let conn = mysql.createConnection({
//     user:'root',
//     password:'Hubu!88661126',
//     host:'122.204.223.14',
//     database:'tmy'
// });

router.get("/data2",(req,res)=>{
    let sql =  'select *\n' +
        'from daping_users_200'
    conn.query(sql,(err,userData)=>{
        res.send({msg:"我是three的路由地址",userData})
    })
});
module.exports=router;
